{% extends '../layouts/layout.html' %}

{% block styles %}
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/smoothness/jquery-ui.css">
{% endblock %}

{% block links %}
<link rel="alternate" type="application/atom+xml" title="{{forum.title}} Feeds - Taipei GTUG Forum" href="/forum/{{forum.permalink}}/feed.xml">
{% endblock %}

{% block scripts %}
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js"></script>
<script src="/js/forum/show.min.js"></script>
{% endblock %}

{% block content %}
<section class="forum-info">
  <header class="forum-title">
    討論區: {{ forum.title }}
  </header>
  <p class="forum-summary">{{ forum.summary }}</p>
</section>
{% if can_post %}
<section id="forum-tools">
  <nav>
    <button id="post-button">發表新主題</button>
  </nav>
</section>
{% endif %}
<table class="forum-table" width="100%">
  <thead>
    <tr>
      <th>主題</th>
      <th width="100">發表者</th>
      <th class="center" width="50">回覆數</th>
      <th width="180">最後回覆</th>
    </tr>
  </thead>
  <tbody>
    {% for t in topics %}<tr class="{% cycle odd,even %}">
      <td><a class="topic-title-link" href="/forum/{{ forum.permalink }}/topic/{{ t.serial }}">{{ t.title }}</a></td>
      <td><a href="/u/{{ t.author.display_name }}">{{ t.author.display_name }}</a></td>
      <td class="center">{{ t.replies_count }}</td>
      <td>
        {{ t.last_replied.display_name }} 於
        {{ t.updated|twtz|date:"Y-m-d H:i" }}
      </td>
    </tr>{% endfor %}
  </tbody>
</table>

<div id="post-dialog" class="hide" title="發表新主題">
  <form method="post" action="#" id="post-form" onsubmit="return false;">
    <fieldset>
      <input type="hidden" name="post[forum]" value="{{ forum.key }}">
      <dl>
        <dt><label class="label" for="post-title">主題:</label></dt>
        <dd><input type="text" name="post[title]" id="post-title" size="50" placeholder="請簡單描述您的問題"></dd>
        <dt><label class="label" for="post-desc">內容:</label></dt>
        <dd>
          <textarea id="post-desc" name="post[desc]" rows="15" cols="50"></textarea>
        </dd>
        <dt><label class="label">&nbsp;</label></dt>
        <dd>
          <span class="text-hint">可以使用 <a href="/bbcode.html" target="_blank">BBCode [?]</a> 格式化內文</span>
        </dd>
      </dl>
    </fieldset>
  </form>
</div>

<div id="posting" class="hide">
  <div class="ui-widget-overlay"></div>
  <div class="ui-widget-shadow ui-corner-all"></div>
  <div id="posting-text" class="ui-widget ui-widget-content ui-corner-all">
		<p><img src="" alt="" width="16" height="16"> 發表中，請稍候...</p>
  </div>
</div>
{% endblock %}
